/*
    Android UIML

	Copyright (C) 2010  Bram Goffings (bramgoffings@gmail.com)

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public License
	as published by the Free Software Foundation; either version 2.1
	of	the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

package uiml.android.rendering;

import java.util.Hashtable;

public class CustomTypeDecoder {

	// Hardcoded
	// We have two hashtables, one with a list of functions that can be handled through reflection
	// The other has a list with functions that handle elements that can't be added through reflection
	protected Hashtable<String, String> typeToFunction = new Hashtable<String, String>();
	protected Hashtable<CustomTypeDecoderDuo, String> nonReflectionMethods = new Hashtable<CustomTypeDecoderDuo, String>();

	/**
	 * 
	 */
	public CustomTypeDecoder() {
		
	}
	
	/**
	 * 
	 * @param type
	 * @return
	 */
	public boolean contains(String type) {
		return typeToFunction.containsKey(type);
	}
	
	/**
	 * 
	 * @param abstractName
	 * @param clas
	 * @param method
	 * @return
	 */
	public boolean contains(String abstractName, String clas, String method) {
	    return nonReflectionMethods.containsKey(new CustomTypeDecoderDuo(abstractName, method));  
	}

	/**
	 * 
	 * @param class1
	 * @return
	 */
	public String getMethodName(String type) {
		return typeToFunction.get(type);
	}
	
	/**
	 * 
	 * @param triple
	 * @return
	 */
	public String getMethodName(CustomTypeDecoderDuo duo) {
		return nonReflectionMethods.get(duo);
	}
	
}
